<?php
/*
 * page to display datagrid of customer records
 * datagrid is displayed asynchronously
*/
//check for a valid session
include("../inc_files/utils/checksession.php");
//include the page header
include("../inc_files/ui/header.php");?>
<title>List customers</title>
<link
	rel="stylesheet" type="text/css" href="../styles/style.css">
<script
	type="text/javascript" src="../scripts/async.js"></script>
<script type='text/javascript'>

//async refresh of tasks datagrid
function refreshgrid(){
	var nochache = Math.floor(Math.random() * 10000);
	getasync('a_listrecords.php?&nocache=' +
			 nochache,'datagrid', true);		
}

function deleterecord(recordid){
//confirm deletion with user
if(confirm("Are you sure you want to mark this record as deleted?"))
	{
		//create a new task then refresh the data grid with new data
		postasync('a_deletecustomer.php','value','recordid='+recordid, false); 
		refreshgrid();
	}
}

</script>
<body>
	<?php 	include("../inc_files/ui/menu.php");?>
	<div id="datagrid"></div>
	<?php
	//add the page footer
	include("../inc_files/ui/footer.php");?>
	<script type="text/javascript">	
	//populate the datagrid
	refreshgrid();	
	</script>
</body>
</html>
